define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'knscy.ticket_out/index',
        add_url: 'knscy.ticket_out/add',
        edit_url: 'knscy.ticket_out/edit',
        delete_url: 'knscy.ticket_out/delete',
        export_url: 'knscy.ticket_out/export',
        modify_url: 'knscy.ticket_out/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh' ,'export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id',search: false},
                    {field: 'order_no', title: '订单NO',minWidth:180},
                    {field: 'ticket_type', title: '类型',search:'select' ,selectList: $nodes.ticketTypeList},
                    {field: 'ticket_sn', title: '门票NO',minWidth:180 },
                    {field: 'ticket_id', title: '门票ID',minWidth:100},
                    {field: 'ticket_title', title: '标题',minWidth:180},
                    {field: 'ticket_subtitle', title: '副标题',minWidth:180},
                    {field: 'select_day', title: '出游时间',minWidth:180},
                    {field: 'is_end', search: 'select', selectList: ["待用","已用"], title: '状态'},
                    {field: 'price', title: '单价',minWidth:100,search:false},
                    {field: 'orgin_price', title: '原价',minWidth:100,search:false},
                    {field: 'total_count', title: '总次数',minWidth:100,search:false},
                    {field: 'use_count', title: '已用次数',minWidth:100,search:false},
                    {field: 'people_info', title: '出行人数据',search:false, minWidth: 200,templet: function (d) {
                            return d.people_info ? '<span class="badge badge">'
                                + d.people_info.first_name+ d.people_info.name + d.people_info.mobile
                                + '</span>':'';
                        }},

                    {field: 'start_time', title: '启用时间',minWidth:180,search:'range'},
                    {field: 'end_time', title: '结束时间',minWidth:180,search:'range'},
                    {field: 'last_use_time', title: '最后使用时间',minWidth:180,search:'range'},
                   // {field: 'sort', title: '排序', edit: 'text',minWidth:120,search: false},
                    //{field: 'status', search: 'select', selectList: ["禁用","启用"], title: '状态', templet: ea.table.switch},
                    {field: 'create_time', title: '创建时间',minWidth:180,search:'range'},
                    {fixed:"right",width: 120, title: '操作',operat: ['edit|明细'], templet: ea.table.tool },
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});